home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 404 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. Path: chronicle.mti.sgi.com!austern
  2. From: esap@cs.tut.fi (Pulkkinen Esa)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Namespace extension
  5. Date: 20 Feb 1996 10:40:30 PST
  6. Organization: Tampere University of Technology
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4g5e4v$cvi@peippo.cs.tut.fi>
  9. References: <4g2aj2$bko@ugress.uib.no>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. Keywords: C++, namespace, template
  12. X-Original-Date: 17 Feb 1996 20:34:39 GMT
  13. Nntp-Posting-User: esap
  14. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  15.     iQBVAwUBMSoVrUy4NqrwXLNJAQEkdAH/cH1iMSQSZ4p8+Iunyb2uQRoyHTmWt2iY
  16.     nLtc8+13Xdt5ng1qnawMs45qFRmiiHl66/eByNylq6JZX5q7srW84Q==
  17.     =qHYN
  18. Originator: austern@isolde.mti.sgi.com
  19.  
  20. In article <4g2aj2$bko@ugress.uib.no>,
  21. Igor Boukanov <boukanov@kvark.fi.uib.no> wrote:
  22. >So I suggest to let template namespaces. In this case it will be possible 
  23. >to write something like this:
  24. [Examples of namespace templates removed]
  25.  
  26. This raises immediately the following questions:
  27.  
  28. template <class T> namespace { // an unnamed namespace template - allowed?
  29.   int i; // how many copies of this will be in the program?
  30.                 // what's the syntax for accessing the variable?
  31.                 // i<T> ?  <T>::i ?
  32.   typedef vector<T>::iterator vector_iterator;  // is this the same
  33.                                                 // as a typedef template?
  34. }
  35. template <class T> namespace X { int f(); }
  36.  
  37. template <class T> using X<T>::f(); // Allowed?
  38. template <class T> using namespace X<T>; // Allowed?
  39.  
  40. [points to justify namespace templates removed]
  41. >  3. It makes C++  easy to study, because somebody will have to know only 
  42. >the general idea about templates and how to apply them to any C++ elements
  43. >(function, class, namespase,...).  
  44.  
  45. This would only be true if also typedef templates and union templates
  46. were introduced too.
  47. -- 
  48.    Esa Pulkkinen                        | C++ programmers do it virtually
  49.    E-Mail:  esap@cs.tut.fi              | everywhere with a class, resulting
  50.    WWW   :  http://www.cs.tut.fi/~esap/ | in multiple inheritance.
  51. ---
  52. [ To submit articles: Try just posting with your newsreader.  If that fails,
  53.                       use mailto:std-c++@ncar.ucar.edu
  54.   FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  55.   Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  56.   Comments? mailto:std.c++-request@ncar.ucar.edu 
  57. ]
  58.